/*
 * @Descripttion:
 * @version:
 * @Author: zhangjing
 * @Date: 2021-11-23 15:12:59
 * @LastEditors: zhangjing
 * @LastEditTime: 2021-11-23 17:10:59
 */
const path = require('path')

function resolve(dir) {
  return path.join(__dirname, dir)
}

// vue.config.js
module.exports = {

  productionSourceMap: false,
  publicPath: process.env.NODE_ENV === 'production' ?
      './' : '/',

  configureWebpack: {},

  chainWebpack: (config) => {
    config.resolve.alias
        .set('@$', resolve('src'))
        .set('@api', resolve('src/api'))
        .set('@assets', resolve('src/assets'))
        .set('@comp', resolve('src/components'))
        .set('@views', resolve('src/views'))
        .set('@layout', resolve('src/layout'))
        .set('@static', resolve('src/static'))

    config.entry('main').add('babel-polyfill');
  },

  css: {
    loaderOptions: {
      less: {
        modifyVars: {

        },
        javascriptEnabled: true,
      }
    }
  },

  devServer: {
    port: 3001,
    proxy: {
      '/park-single': {
        target: 'http://127.0.0.1:8094', //请求本地后台项目
        ws: true,
        changeOrigin: true,
        // pathRewrite: {
        //   '^/park-single': '/' //默认所有请求前缀，需要去掉
        // }
      },
      '/static/images': {
        target: 'http://127.0.0.1:8094', //请求本地后台项目
        ws: true,
        changeOrigin: true
      }
    },
    public: '127.0.0.1:3001', // 本地的ip:端口号
  },
  lintOnSave: false
}
